package dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import pojo.Department;

import java.util.List;

public interface DepartmentMapper {

    @Select("select * from department ")
    List<Department> findAll();

    @Insert("INSERT INTO department(department_name, level, parent_id, create_time) " +
            "VALUES(#{departmentName}, #{level}, #{parentId}, #{createTime})")
    int addDepartment(Department department);

    @Update("update department set department_name=#{department_name},level=#{level},parent_id=#{parent_id},create_time=#{create_time} where department_id=#{department_id}")
    int updateDepartment(Department department);

    @Delete("delete from department where department_id=#{department_id}")
    int deleteDepartment(int department_id);
    @Select("select * from department where level=#{level}")
    List<Department> findByLeve(int leve);
}
